//
//  PostStepThreeViewController.m
//  CarpoolWithFriends
//
//  Created by Kai Wang on 4/29/12.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
//

#import "PostStepThreeViewController.h"
#import "PostStepFourViewController.h"

@interface PostStepThreeViewController()
// Private Properties:

// Private Methods:
-(void)revealStepFour:(id)sender;
@end

@implementation PostStepThreeViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)dealloc
{
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

-(void)viewWillAppear:(BOOL)animated
{
    self.title = NSLocalizedString(@"Post Step Three", @"Post Step Three");
    
    // right navigation button
    if(![self.navigationItem rightBarButtonItem])
    {
        // if not, allocate one and add it
        UIBarButtonItem *nextButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Step Four", @"Step Four") style:UIBarButtonItemStylePlain target:self action:@selector(revealStepFour:)];
        self.navigationItem.rightBarButtonItem = nextButton;
        [nextButton release];
    }
    
    [super viewWillAppear:animated];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

-(void)revealStepFour:(id)sender
{
    PostStepFourViewController *viewController = [[PostStepFourViewController alloc] init];
    viewController.view.backgroundColor = [UIColor whiteColor];
    [self.navigationController pushViewController:viewController animated:YES];
    [viewController release];
}

@end
